﻿using System;
using System.Collections.Generic;

namespace YArchitech.Plumbing
{
	public class FloorSystem
	{
		public FloorSystem()
		{
			this.indoorSystems = new List<IndoorSystem>();
		}

		public FloorSystem(FloorSystem floorSystem)
		{
			this.preSerialNum = floorSystem.preSerialNum;
			this.serialNum = floorSystem.serialNum;
			this.indoorNum = floorSystem.indoorNum;
			this.indoorSystems = this.InitialIndoorSystems(floorSystem.indoorSystems);
			this.load = floorSystem.load;
			this.flow = floorSystem.flow;
			this.pressCapital = floorSystem.pressCapital;
			this.pressActual = floorSystem.pressActual;
			this.rateUnbalance = floorSystem.rateUnbalance;
		}

		private IList<IndoorSystem> InitialIndoorSystems(IList<IndoorSystem> inSystems)
		{
			IList<IndoorSystem> list = new List<IndoorSystem>();
			if (inSystems == null || inSystems.Count < 1)
			{
				return list;
			}
			foreach (IndoorSystem indoorSystem in inSystems)
			{
				IndoorSystem item = new IndoorSystem(indoorSystem);
				list.Add(item);
			}
			return list;
		}

		private double GetLoad()
		{
			double num = 0.0;
			foreach (IndoorSystem indoorSystem in this.IndoorSystems)
			{
				num += indoorSystem.Load;
			}
			return num;
		}

		private double GetFlow()
		{
			double num = 0.0;
			foreach (IndoorSystem indoorSystem in this.IndoorSystems)
			{
				num += indoorSystem.Flow;
			}
			return num;
		}

		public string PreSerialNum
		{
			get
			{
				return this.preSerialNum;
			}
			set
			{
				this.preSerialNum = value;
			}
		}

		public string SerialNum
		{
			get
			{
				return this.serialNum;
			}
			set
			{
				this.serialNum = value;
			}
		}

		public int IndoorNum
		{
			get
			{
				return this.IndoorSystems.Count;
			}
			set
			{
				this.indoorNum = value;
			}
		}

		public IList<IndoorSystem> IndoorSystems
		{
			get
			{
				return this.indoorSystems;
			}
			set
			{
				this.indoorSystems = value;
			}
		}

		public double Load
		{
			get
			{
				return this.GetLoad();
			}
			set
			{
				this.load = value;
			}
		}

		public double Flow
		{
			get
			{
				return this.GetFlow();
			}
			set
			{
				this.flow = value;
			}
		}

		public double PressCapital
		{
			get
			{
				return this.pressCapital;
			}
			set
			{
				this.pressCapital = value;
			}
		}

		public double PressActual
		{
			get
			{
				return this.pressActual;
			}
			set
			{
				this.pressActual = value;
			}
		}

		public double RateUnbalance
		{
			get
			{
				return this.rateUnbalance;
			}
			set
			{
				this.rateUnbalance = value;
			}
		}

		private string preSerialNum;

		private string serialNum;

		private int indoorNum;

		private IList<IndoorSystem> indoorSystems;

		private double load;

		private double flow;

		private double pressCapital;

		private double pressActual;

		private double rateUnbalance;
	}
}
